import { Widget, sys } from "cc";
import ComponentBase from "./ComponentBase";


export default class AdapterComponent extends ComponentBase {

    private widget: Widget;

    onLoad(): void {
        super.onLoad()
        this.widget = this.node.getComponent(Widget);
        if (this.widget.isAlignLeft) {
            this.widget.left += sys.getSafeAreaRect().x
        }
        if (this.widget.isAlignRight) {
            this.widget.right += sys.getSafeAreaRect().x
        }
        if (this.widget.isAlignTop) {
            this.widget.top += sys.getSafeAreaRect().y
        }
        if (this.widget.isAlignBottom) {
            this.widget.bottom += sys.getSafeAreaRect().y
        }
    }

}
